package org.yefei.homeworkday08;

import java.util.Scanner;

public class ArraysFive {

	public static void main(String[] args) {
		// 0:定义一个String类型的数组，存放我们班学生姓名，然后输入一个名字，查找其是否存在
		String[] names = { "张三", "李四", "王五", "张六", "孙悟空", "猪八戒" };
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入一个同学姓名：");
		String name = sc.next();
		for (int i = 0; i < names.length; i++) {
			if (name.equals(names[i])) {
				System.out.println("该同学在我们班！");
				break;
			}
			if (i == names.length - 1) {
				System.out.println("该同学不是我们班的！");
			}
		}
	}

}
